<template>
  <el-container>
    <!-- 侧边栏 -->
    <el-aside width="200px">
      <el-menu
        default-active="home"
        class="el-menu-vertical-demo"
        @open="handleOpen"
        @close="handleClose"
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b"
        router
      >
        <el-menu-item index="0" disabled>
          <span slot="title">HAPPY MMALL</span>
        </el-menu-item>
        <el-menu-item index="home">
          <i class="el-icon-s-data"></i>
          <span slot="title">首页</span>
        </el-menu-item>
        <el-submenu index="2">
          <template slot="title">
            <i class="el-icon-s-fold"></i>
            <span>商品</span>
          </template>
          <el-menu-item index="goods">商品管理</el-menu-item>
          <el-menu-item index="category">品类管理</el-menu-item>
        </el-submenu>
        <el-submenu index="3">
          <template slot="title">
            <i class="el-icon-circle-check"></i>
            <span>订单</span>
          </template>
          <el-menu-item index="order">订单管理</el-menu-item>
        </el-submenu>
        <el-submenu index="4">
          <template slot="title">
            <i class="el-icon-user"></i>
            <span>用户</span>
          </template>
          <el-menu-item index="user">用户列表</el-menu-item>
        </el-submenu>
      </el-menu>
    </el-aside>
    <el-container>
      <el-header>
        <p></p>
        <el-dropdown @command="goLogin">
          <span class="el-dropdown-link">
            <i class="el-icon-user-solid"></i>
            欢迎，admin<i class="el-icon-caret-bottom"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item 
              ><i class="el-icon-s-promotion"></i>退出登录</el-dropdown-item
            >
          </el-dropdown-menu>
        </el-dropdown>
      </el-header>
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
    };
  },
  methods: {
    //退出登录
    goLogin() {
      this.$router.push("/login");
    },
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
  },
  created() {},
  mounted() {},
  components: {},
  computed: {},
  watch: {},
};
</script>

<style lang='scss' scoped>
.el-menu {
  height: 100vh;
}
.el-header {
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 10vh;
}
.el-main {
  padding: 0;
  height: 90vh;
  background: #eee;
}
</style>
